jsx3.Class.defineClass(
        "tibco.admin.monitormanage.uicomponents.page.dashboard.tabContent.serviceSystemMetrics.ServiceSystemMetrics", //the full name of the class to create
        jsx3.lang.Object, //  extends
        [tibco.admin.monitormanage.uicomponents.page.dashboard.DashboardTabInterface], // implements
        function (plugin) {
        
            plugin.instance = null
            plugin.dashboardScreenId = "tibco.admin.monitormanage.uicomponents.page.dashboard.Dashboard.dashboardScreen";
            plugin.getInstance = function(args) {
                if(!this.instance) {
                    this.instance = new tibco.admin.monitormanage.uicomponents.page.dashboard.tabContent.serviceSystemMetrics.ServiceSystemMetrics();
                }
                return this.instance;
            }

            plugin.prototype.getNamespace = function() {
               return "tibco.admin";
            }
            
            plugin.prototype.getTabText = function() {
				return tibco.admin.Main.getServer().getDynamicProperty("@MM@general@OverviewTitle");
            }

            plugin.prototype.loadComponent = function(parent) {
                var overviewBlock = tibco.admin.Main.loadUIResource(parent, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/page/dashboard/tabContent/serviceSystemMetrics/components/serviceSystemMetrics.xml", true);

				var topServiceHitsPane = overviewBlock.getDescendantOfName("topServiceHitsPane");
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.table || !tibco.admin.monitormanage.uicomponents.table.topServiceHits || !tibco.admin.monitormanage.uicomponents.table.topServiceHits.TopServiceHits)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/table/topServiceHits/TopServiceHits.js", this.getNamespace()); }
                tibco.admin.Main.loadUIResourceAsync(topServiceHitsPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/table/topServiceHits/components/topServiceHits.xml", this, this.loadHitsTableData);

				var topServiceFaultsPane = overviewBlock.getDescendantOfName("topServiceFaultsPane");
				if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.table || !tibco.admin.monitormanage.uicomponents.table.topServiceFaults || !tibco.admin.monitormanage.uicomponents.table.topServiceFaults.TopServiceFaults)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/table/topServiceFaults/TopServiceFaults.js", this.getNamespace()); }
                tibco.admin.Main.loadUIResourceAsync(topServiceFaultsPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/table/topServiceFaults/components/topServiceFaults.xml", this, this.loadFaultTableData);

                var dashboardMachinesPane = overviewBlock.getDescendantOfName("dashboardMachinesPane");
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.table || !tibco.admin.monitormanage.uicomponents.table.machines || !tibco.admin.monitormanage.uicomponents.table.machines.Machines)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/table/machines/Machines.js", this.getNamespace()); }
                tibco.admin.Main.loadUIResourceAsync(dashboardMachinesPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/table/machines/components/machines.xml", this, this.loadMachinesTable);                                      

				var dashboardNodesPane = overviewBlock.getDescendantOfName("dashboardNodesPane");
                if(!tibco.admin.monitormanage || !tibco.admin.monitormanage.uicomponents || !tibco.admin.monitormanage.uicomponents.table || !tibco.admin.monitormanage.uicomponents.table.nodes || !tibco.admin.monitormanage.uicomponents.table.nodes.Nodes)
                { tibco.admin.Main.loadClass("tibco/admin/monitormanage/uicomponents/table/nodes/Nodes.js", this.getNamespace()); }
                tibco.admin.Main.loadUIResourceAsync(dashboardNodesPane, this.getNamespace(), "tibco/admin/monitormanage/uicomponents/table/nodes/components/nodes.xml", this, this.loadNodesTable);
            }

			plugin.prototype.loadMachinesTable = function(objEvent) {
				if(objEvent.status == "SUCCESS")
			   	{
			    	var machinesTable = objEvent.obj;
					machinesTable.setUpComponent("_MM_dshbrd", true, true, plugin.dashboardScreenId, true);
                	tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, machinesTable, machinesTable.updateComponent, plugin.dashboardScreenId);
                	tibco.admin.monitormanage.general.RefreshHandler.register(machinesTable, machinesTable.updateComponent, plugin.dashboardScreenId);
			    }
			    else
			    {
			    	jsx3.log(objEvent.message);
			    	if(objEvent.exception)
			        { jsx3.log(objEvent.exception.printStackTrace()); }
			    }
            }
            
            plugin.prototype.loadNodesTable = function(objEvent) {
				if(objEvent.status == "SUCCESS")
			   	{
			    	var nodesTable = objEvent.obj;
					nodesTable.setUpComponent("_MM_dshbrd", false, false, null, null, true, true, plugin.dashboardScreenId, true);
                    tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, nodesTable, nodesTable.updateComponent, plugin.dashboardScreenId);
                    tibco.admin.monitormanage.general.RefreshHandler.register(nodesTable, nodesTable.updateComponent, plugin.dashboardScreenId);
			    }
			    else
			    {
			    	jsx3.log(objEvent.message);
			    	if(objEvent.exception)
			        { jsx3.log(objEvent.exception.printStackTrace()); }
			    }
            }

            plugin.prototype.loadHitsTableData = function(objEvent) {
				if(objEvent.status == "SUCCESS")
			    {
			    	var modelObj = objEvent.obj;
			        modelObj.setUpComponent("_MM_dshbrd", plugin.dashboardScreenId);
			        tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, modelObj, modelObj.updateComponent, plugin.dashboardScreenId);
			        tibco.admin.monitormanage.general.RefreshHandler.register(modelObj, modelObj.updateComponent, plugin.dashboardScreenId);
			    }
			    else
			    {
			    	jsx3.log(objEvent.message);
			        if(objEvent.exception)
			        { jsx3.log(objEvent.exception.printStackTrace()); }
			    }
            }

            plugin.prototype.loadFaultTableData = function(objEvent) {
				if(objEvent.status == "SUCCESS")
			    {
			    	var modelObj = objEvent.obj;
					modelObj.setUpComponent("_MM_dshbrd", plugin.dashboardScreenId);
			        tibco.admin.monitormanage.general.PollingHandler.register(tibco.admin.monitormanage.general.PollingHandler.GENERAL_POLLING_HANDLER_ID, modelObj, modelObj.updateComponent, plugin.dashboardScreenId);
			        tibco.admin.monitormanage.general.RefreshHandler.register(modelObj, modelObj.updateComponent, plugin.dashboardScreenId);
			    }
			    else
                {
                   jsx3.log(objEvent.message);
                   if(objEvent.exception)
                   { jsx3.log(objEvent.exception.printStackTrace()); }
                }
            }
            
            plugin.prototype.updateComponent = function() {
            	// this method does not have to do anything considering the component update is
            	// handled by the components within this component
            	jsx3.log("Dashboard overview tab had updateComponent called"); 
            }
            
            plugin.prototype.tabClicked = function(objEvent) {
            	tibco.admin.monitormanage.uicomponents.dropdown.timeframe.Timeframe.showTimeframe(tibco.admin.monitormanage.uicomponents.page.deployment.Deployment.serviceUnitScreenId);
        	}

        });